/**
 * OSS is a Open Service Container which gives the leverage of building the Desktop and Web
 * Application. * Copyright (C) 2008-2009  Ponraj Sutanthiramani
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Or5e Open Source Community
 * 105, S.S Paradise Apartment, Munnireddy Layout, Horamavu, Banaswadi, Bangalore, India.
 */
package org.or5e.core;

import java.security.AccessControlException;
import java.security.Permission;

/**
 * This is the API Specific Security Management Class. Here we validate the API Access Permission
 * of the API Users. We have the Rights permission for different API for Desktop and Web Flavour of API
 * Usage.
 * @author Ponraj Suthanthiramani
 */
public final class BaseSecurityManager extends SecurityManager{
    private final int DESKTOP_LICENSE = 1;
    private final int WEB_LICENSE = 2;
    private final int DEMO_LICENSE = 3;

    public Integer checkLicense(String key) throws SecurityException {
        if(key.equals("DESKTOP")) {
            return this.DESKTOP_LICENSE;
        }
        else if(key.equals("WEB")) {
            return this.WEB_LICENSE;
        }
        else if(key.equals("DEMODEMO")) {
            System.out.println("You are running with Demo License.");
            return this.DEMO_LICENSE;
        }
        throw new SecurityException("License Key is INVALID. Purchase a new License.");
    }
    public void checkMediaAccess(String key) throws SecurityException {
    }
    public void checkMailAccess(String key) throws SecurityException {
    }
    public void checkSMSAccess(String key) throws SecurityException {
    }
    public void checkUploadAccess(String key) throws SecurityException {
    }
    public void checkServerDBAccess(String key) throws SecurityException {
    }
    public void checkWebCamAccess(String licenseKey) throws SecurityException {
    }
    public void checkGoogleAPIAccess(String key) throws SecurityException {
    }

    @Override
    public void checkPermission(Permission perm) throws AccessControlException {
    }
}
